package com.aletto.general_store.data.model;


import com.sisyphus.spinach.core.model.IResponse;

public class Response<T> implements IResponse<T> {

    private T data;
    private int code;
    private String message;

    public Response() {
    }

    public Response(T data) {
        this(data, 200, "success");
    }

    public Response(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Response(T data, int code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

    @Override
    public boolean isSuccessful() {
        return code == 200;
    }

    @Override
    public int getErrorCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    @Override
    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

}
